﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MethodWorx.CMS.Services;
using System.Web.Mvc;
using MethodWorx.Core.DomainModel;
using MethodWorx.CMS.Content;
using MethodWorx.Core.Validation;
using MethodWorx.CMS.Requests;

namespace MethodWorx.CMS.UI.Models
{
    public class WorkflowModel
    {
        protected ContentService content;
        protected WorkflowService workflow;
        protected Page page;

        public WorkflowModel(ContentService content, WorkflowService workflow)
        {
            this.content = content;
            this.workflow = workflow; 
        }

        public WorkflowRequest Request { get; set; }


        public SelectList GetHttpMethodSelectList()
        {
            return new SelectList(new string[] { "POST", "GET" });
        }

        public SelectList GetPageEventsSelectList()
        {
            return new SelectList(new string[] { "Publish" });
        }

        public virtual void Initialize(Guid id)
        {
            this.page = this.content.GetPageById(id);
            if (page == null)
                throw new BusinessRuleException("Page Not Found");

            this.Request = new WorkflowRequest(this.page);
        }

        public virtual void Complete(IValidationProvider provider)
        {

        }
    }
}